#ifndef _PLAYER_H_
#define _PLAYER_H_

#include "vec.hpp"
#include <vector>

class Stage;
class Cue;

//class Enemy;
class Item;
class Door;

class Image;
class Sound;

#include "actor.hpp"

class Player : public Actor
{
public:
	Player();
	~Player();

	bool Vulnerable();
	bool Acting();
	bool Crouching();

	static bool TOpen(Cue & cue);
	void Close();

	void Init(float x, float y, Cue & cue);
	
	float Advantage() const;
	float AdvantageOver(const Player & other) const;
	void AI();
	void In(const Vec2f & injoy, int inbuttons);

	Vec2i StairFind(int diry)
	{
		return StairFind(body.CentBot(), diry);
	}
	
	Vec2i StairFind(const Vec2f & p, int diry);
	Vec2i StairTake(int diry);
	void Update();

	void Hit(Weapon & en);
	void Hit(Item & itm);
	void Hit(Door & door);

	void HUDInit();
	void HUDUpdate();

	Vec2f WeaponPos();

	void HPAdd(int delta);
	//void AmmoAdd(int delta);

	//static const int HPMAX;

	//friend class Enemy;
	friend class Item;
	friend class Weapon;
	friend class GameScreen;

private:
	int type;

	// actions
	int action;
	int nextaction;
	float actioncycle;
	void ActionChange(int a);

	// states
	int state;
	int nextstate;
	float stcycle;
	void StateChange(int s);

	// game
	int mag;
	std::vector<int> magammo;

	// AI
	Vec2f dest;
	Vec2f aijoy;
};

extern Player Plr;
extern ActPool<Player, 31> Enmes;

#endif
